# coding=utf-8
import urllib2


headers = {'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Safari/604.1.38'}


class ImageHandler:
    def __init__(self):
        pass

    @staticmethod
    def save_image(file_path, image_url):
        request1 = urllib2.Request(url=image_url, headers=headers)
        img_data = urllib2.urlopen(request1).read()

        new_file = open(file_path, 'w')
        new_file.write(img_data)
        new_file.close()
        return
